package cn.buk.tms.eotms.report.dto;

import com.fasterxml.jackson.annotation.JsonPropertyOrder;

import java.util.List;

@JsonPropertyOrder({"total",
        "flights", "flightCount", "flightTotal",
        "refunds", "refundCount", "refundTotal",
        "changes", "changeCount", "changeTotal",
        "services", "serviceCount", "serviceTotal",
        "hotels", "hotelCount", "hotelTotal",
        "trains", "trainCount", "trainTotal"
})
public class MonthlyReport {

  private List<ReportFlightTicketDto> flights;
  private List<ReportFlightRefundDto> refunds;
  private List<ReportFlightChangeDto> changes;
  private List<ReportVasDto> services;
  private List<ReportHotelDto> hotels;
  private List<ReportTrainDto> trains;
  /**
   * 所有项目的总金额
   */
  private double total;
  /**
   * 机票数量
   */
  private int flightCount;
  /**
   * 机票总金额
   */
  private double flightTotal;

  private int refundCount;
  private double refundTotal;
  private int changeCount;
  private double changeTotal;
  private int serviceCount;
  private double serviceTotal;
  private int hotelCount;
  private double hotelTotal;
  private int trainCount;
  private double trainTotal;

  public void calc() {
    this.flightCount = this.getFlights().size();
    this.refundCount = this.getRefunds().size();
    this.changeCount = this.getChanges().size();
    this.serviceCount = this.getServices().size();
    this.hotelCount = this.getHotels().size();
    this.trainCount = this.getTrains().size();

    for(ReportFlightTicketDto dto: this.getFlights()) {
      this.flightTotal += dto.getTotal();
    }
    this.total += this.flightTotal;

    for(ReportFlightRefundDto dto: this.getRefunds()) {
      this.refundTotal += dto.getTotal();
    }
    this.total += this.refundTotal;

    for(ReportFlightChangeDto dto: this.getChanges()) {
      this.changeTotal += dto.getTotal();
    }
    this.total += this.changeTotal;

    for(ReportVasDto dto: this.getServices()) {
      this.serviceTotal += dto.getTotal();
    }
    this.total += this.serviceTotal;

    for(ReportHotelDto dto: this.getHotels()) {
      this.hotelTotal += dto.getTotal();
    }
    this.total += this.hotelTotal;

    for(ReportTrainDto dto: this.getTrains()) {
      this.trainTotal += dto.getTotal();
    }
    this.total += this.trainTotal;
  }

  public List<ReportFlightTicketDto> getFlights() {
    return flights;
  }

  public void setFlights(List<ReportFlightTicketDto> flights) {
    this.flights = flights;
  }

  public List<ReportFlightRefundDto> getRefunds() {
    return refunds;
  }

  public void setRefunds(List<ReportFlightRefundDto> refunds) {
    this.refunds = refunds;
  }

  public List<ReportFlightChangeDto> getChanges() {
    return changes;
  }

  public void setChanges(List<ReportFlightChangeDto> changes) {
    this.changes = changes;
  }

  public List<ReportVasDto> getServices() {
    return services;
  }

  public void setServices(List<ReportVasDto> services) {
    this.services = services;
  }

  public List<ReportHotelDto> getHotels() {
    return hotels;
  }

  public void setHotels(List<ReportHotelDto> hotels) {
    this.hotels = hotels;
  }

  public List<ReportTrainDto> getTrains() {
    return trains;
  }

  public void setTrains(List<ReportTrainDto> trains) {
    this.trains = trains;
  }

  public double getTotal() {
    return total;
  }


  public int getFlightCount() {
    return flightCount;
  }

  public double getFlightTotal() {
    return flightTotal;
  }

  public int getRefundCount() {
    return refundCount;
  }

  public double getRefundTotal() {
    return refundTotal;
  }

  public int getChangeCount() {
    return changeCount;
  }

  public double getChangeTotal() {
    return changeTotal;
  }

  public int getServiceCount() {
    return serviceCount;
  }

  public double getServiceTotal() {
    return serviceTotal;
  }

  public int getHotelCount() {
    return hotelCount;
  }

  public double getHotelTotal() {
    return hotelTotal;
  }

  public int getTrainCount() {
    return trainCount;
  }

  public double getTrainTotal() {
    return trainTotal;
  }
}
